package cfgs.gestudent.dao.alumnes;

import java.sql.Connection;
import java.sql.SQLException;

import cfgs.gestudent.dao.connexio.ConnexioDB;
import cfgs.gestudent.preferencies.ConfiguracionsIdiomes;

import java.sql.PreparedStatement;
import java.util.ResourceBundle;

import javax.swing.JOptionPane;

public class ModificarAlumne {
	
	private Connection conn = ConnexioDB.getConnexio();

	private ConfiguracionsIdiomes idioma = new ConfiguracionsIdiomes();
	private ResourceBundle rb = idioma.getIdioma();
	
	public boolean update(String valors, int id)
    {
        boolean res = false;
        String q = " UPDATE ALUMNE SET " + valors + " WHERE Id= " + id;
        try {
            PreparedStatement pstm = conn.prepareStatement(q);
            pstm.execute();
            pstm.close();
            res=true;
         }catch(SQLException e){
        	 JOptionPane.showMessageDialog(null, rb.getString("missatgeErrorModAlumne"), rb.getString("titolErrorModAlumne"), JOptionPane.ERROR_MESSAGE);
        }
        return res;
    }

}
